package com.mes.system.service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.mes.common.service.BasicService;
import com.mes.system.dao.iface.IEmployeeRoleDao;
import com.mes.system.domain.EmployeeRole;
import com.mes.system.manager.iface.IEmployeeRoleManager;

@Service
public class EmpRoleService extends BasicService<EmployeeRole> {

	@Autowired
	private IEmployeeRoleDao employeeRoleDao;
	
	@Autowired
	private IEmployeeRoleManager employeeRoleManager;
	
	@DataProvider
	public Collection<EmployeeRole> getEmpRoleByEmp(String employeeUid) throws Exception{
		Collection<EmployeeRole> employeeRoles = new ArrayList<>();
		employeeRoles = employeeRoleDao.findByProperty("employeeUid", employeeUid);
		return employeeRoles;
	}
	
	@DataResolver
	public void saveEmpRole(List<EmployeeRole> employeeRoles) throws Exception{
		employeeRoleManager.saveEmpRole(employeeRoles);
	}
	
	@DataProvider
	public String getBdfRoleId(String roleUid) throws Exception{
		return employeeRoleDao.getBdfRoleId(roleUid);
	}
	
	
}
